module enqueueArbiter4 (
    input wire queue_en_1,
    input wire [5:0] data_priority_1,
    input wire queue_en_2,
    input wire [5:0] data_priority_2,
    input wire queue_en_3,
    input wire [5:0] data_priority_3,
    input wire queue_en_4,
    input wire [5:0] data_priority_4,
    output wire [3:0] enqueue_arbitration
);

    //比较器数组
    wire [6:0] priority_bigger;
    
    //构建数组
    assign priority_bigger[0] = data_priority_1 >= data_priority_2;  //0-1
    assign priority_bigger[1] = data_priority_1 >= data_priority_3;  //0-2
    assign priority_bigger[2] = data_priority_1 >= data_priority_4;  //0-3
    assign priority_bigger[3] = data_priority_2 >= data_priority_3;  //1-2
    assign priority_bigger[4] = data_priority_2 >= data_priority_4;  //1-3
    assign priority_bigger[5] = data_priority_3 >= data_priority_4;  //2-3

    //根据优先级的值选择最大的那一个
    assign enqueue_arbitration[0] = queue_en_1 & priority_bigger[0] & priority_bigger[1] & priority_bigger[2];
    assign enqueue_arbitration[1] = queue_en_2 & ~priority_bigger[0] & priority_bigger[3] & priority_bigger[4];
    assign enqueue_arbitration[2] = queue_en_3 & ~priority_bigger[1] & ~priority_bigger[3] & priority_bigger[5];
    assign enqueue_arbitration[3] = queue_en_4 & ~priority_bigger[2] & ~priority_bigger[4] & ~priority_bigger[5];
endmodule